/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package film.modeles.entity;

import commande.modeles.entity.Produit;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author MAZID
 */
@Entity
public class Support implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idSupport", nullable = false)
    private Integer idSupport;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "libelleS", nullable = false, length = 10)
    private String libelleS;
    
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "support")
    private Collection<Produit> produit;

    public Support() {
    }

    public Support(Integer idSupport) {
        this.idSupport = idSupport;
    }

    public Support(Integer idSupport, String libelleS) {
        this.idSupport = idSupport;
        this.libelleS = libelleS;
        
    }

    public Integer getSupport() {
        return idSupport;
    }

    public void setSupport(Integer idSupport) {
        this.idSupport = idSupport;
    }

    public String getLibelleS() {
        return libelleS;
    }

    public void setLibelleS(String libelleS) {
        this.libelleS = libelleS;
    }

    @XmlTransient
    public Collection<Produit> getProduit() {
        return produit;
    }

    public void setProduit(Collection<Produit> produit) {
        this.produit = produit;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSupport != null ? idSupport.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Support)) {
            return false;
        }
        Support other = (Support) object;
        if ((this.idSupport == null && other.idSupport != null) || (this.idSupport != null && !this.idSupport.equals(other.idSupport))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "film.models.entity.Support[ idSupport=" + idSupport + " ]";
    }
    
}
